#ifndef _YEP_SCENETEST_DRAW_HANDLER_HPP
#define _YEP_SCENETEST_DRAW_HANDLER_HPP

#include "framework/Entity.hpp"
#include "framework/DrawHandler.hpp"
#include "framework/DrawEvent.hpp"
#include "core/Game.hpp"
#include "video/Screen.hpp"
#include "math/Vector2.hpp"
#include "video/Color.hpp"

namespace yep
{
    /**
     * @brief Tests the Draw handling
     **/
    class DrawHandlerTest: public Entity, public DrawHandler
    {
    public:
        DrawHandlerTest(const Vector2 &position, const Vector2 &size, const Color &color, double depth):
            _position(position), _size(size), _color(color), _depth(depth)
            {}
        ~DrawHandlerTest(){}

        Vector2 getTopLeft()
        {
            return _position;
        }

        Vector2 getBottomRight()
        {
            return _position + _size;
        }

        double getDepth()
        {
            return _depth;
        }

        void evDraw(DrawEvent &event)
        {
            Screen &screen = event.getScreen();
            screen.fillRectangle(_position+event.getViewPosition(), _size, _color);
        }

        void evCreate(Event &event)
        {
            event.getScene().handleDraw(*this);
        }

        void evDestroy(Event &event)
        {
            event.getScene().unhandleDraw(*this);
            delete this;
        }
    private:
        Vector2 _position;
        Vector2 _size;
        Color _color;
        double _depth;
    };


}

#endif // _YEP_SCENETEST_DRAW_HANDLER_HPP

